package com.haoshuang.zhouzhoubang.model.api

import com.haoshuang.zhouzhoubang.config.URLConstants
import com.haoshuang.zhouzhoubang.model.bean.AppVersionBean
import com.haoshuang.zhouzhoubang.model.bean.AppealDetailBean
import com.haoshuang.zhouzhoubang.model.bean.BalanceDetailGroupListBean
import com.haoshuang.zhouzhoubang.model.bean.CallBean
import com.haoshuang.zhouzhoubang.model.bean.ChooseServiceBean
import com.haoshuang.zhouzhoubang.model.bean.CityBean
import com.haoshuang.zhouzhoubang.model.bean.CooperationTimeBean
import com.haoshuang.zhouzhoubang.model.bean.DJDetailBean
import com.haoshuang.zhouzhoubang.model.bean.DataRankBean
import com.haoshuang.zhouzhoubang.model.bean.DataStatisticalBean
import com.haoshuang.zhouzhoubang.model.bean.DepositBean
import com.haoshuang.zhouzhoubang.model.bean.DepositGroupByDayBean
import com.haoshuang.zhouzhoubang.model.bean.DetaiBean
import com.haoshuang.zhouzhoubang.model.bean.ErrorMessageBean
import com.haoshuang.zhouzhoubang.model.bean.EwBean
import com.haoshuang.zhouzhoubang.model.bean.ExamQuestionBean
import com.haoshuang.zhouzhoubang.model.bean.ExtraCostsPayBean
import com.haoshuang.zhouzhoubang.model.bean.FaceParamsBean
import com.haoshuang.zhouzhoubang.model.bean.FocusDateBean
import com.haoshuang.zhouzhoubang.model.bean.FreeOrderWelfareBean
import com.haoshuang.zhouzhoubang.model.bean.HexiaoOrderBean
import com.haoshuang.zhouzhoubang.model.bean.HexiaoOrderInfoBean
import com.haoshuang.zhouzhoubang.model.bean.Home4Bean
import com.haoshuang.zhouzhoubang.model.bean.HomeBean
import com.haoshuang.zhouzhoubang.model.bean.HomeDataBean
import com.haoshuang.zhouzhoubang.model.bean.IDCardBean
import com.haoshuang.zhouzhoubang.model.bean.InsureApplyRecordBean
import com.haoshuang.zhouzhoubang.model.bean.InsureUseRecordBean
import com.haoshuang.zhouzhoubang.model.bean.Jn2Bean
import com.haoshuang.zhouzhoubang.model.bean.Jnrz
import com.haoshuang.zhouzhoubang.model.bean.LoginHelpTelBean
import com.haoshuang.zhouzhoubang.model.bean.MasterStoreOrderBean
import com.haoshuang.zhouzhoubang.model.bean.MemberBean
import com.haoshuang.zhouzhoubang.model.bean.MessageBean
import com.haoshuang.zhouzhoubang.model.bean.MessageStatisticsBean
import com.haoshuang.zhouzhoubang.model.bean.MyContractBean
import com.haoshuang.zhouzhoubang.model.bean.NumBean
import com.haoshuang.zhouzhoubang.model.bean.OrderBean
import com.haoshuang.zhouzhoubang.model.bean.OrderDetail2Bean
import com.haoshuang.zhouzhoubang.model.bean.OrderDetailBean
import com.haoshuang.zhouzhoubang.model.bean.OrderWorkerBean
import com.haoshuang.zhouzhoubang.model.bean.PlatformWelfareBean
import com.haoshuang.zhouzhoubang.model.bean.PushOrderWelfareBean
import com.haoshuang.zhouzhoubang.model.bean.RemoteAddressBean
import com.haoshuang.zhouzhoubang.model.bean.RenWuBean
import com.haoshuang.zhouzhoubang.model.bean.SettledInfoBean
import com.haoshuang.zhouzhoubang.model.bean.ShopWelfareRecordBean
import com.haoshuang.zhouzhoubang.model.bean.SkillAddBean
import com.haoshuang.zhouzhoubang.model.bean.SmBean
import com.haoshuang.zhouzhoubang.model.bean.SpreadServiceRecordBean
import com.haoshuang.zhouzhoubang.model.bean.StoreMemberDataStatisticalBean
import com.haoshuang.zhouzhoubang.model.bean.StoreServiceDataStatisticalBean
import com.haoshuang.zhouzhoubang.model.bean.StoreServiceSkillBean
import com.haoshuang.zhouzhoubang.model.bean.StoreYearMoneyBean
import com.haoshuang.zhouzhoubang.model.bean.SystemConfigBean
import com.haoshuang.zhouzhoubang.model.bean.SystemMsgBean
import com.haoshuang.zhouzhoubang.model.bean.TakeOrderBean
import com.haoshuang.zhouzhoubang.model.bean.TakeOrderPayCodeBean
import com.haoshuang.zhouzhoubang.model.bean.TakeOrderRecordBean
import com.haoshuang.zhouzhoubang.model.bean.TeamMemberBean
import com.haoshuang.zhouzhoubang.model.bean.TeamMessageBean
import com.haoshuang.zhouzhoubang.model.bean.YyBean
import com.haoshuang.zhouzhoubang.model.bean.TeamSettingsInfoBean
import com.haoshuang.zhouzhoubang.model.bean.TimeBean2
import com.haoshuang.zhouzhoubang.model.bean.ToolUseRecordBean
import com.haoshuang.zhouzhoubang.model.bean.TrainArticleBean
import com.haoshuang.zhouzhoubang.model.bean.TrainLabelBean
import com.haoshuang.zhouzhoubang.model.bean.UserBean
import com.haoshuang.zhouzhoubang.model.bean.WalletBean
import com.haoshuang.zhouzhoubang.model.bean.WithdrawableBean
import com.haoshuang.zhouzhoubang.model.bean.YanShou
import com.lnkj.jialubao.utils.AccountUtils
import com.mufeng.libs.net.ResponseBean
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.disposables.Disposable
import io.reactivex.rxjava3.schedulers.Schedulers
import kotlinx.coroutines.flow.Flow
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toFlowResponse

/**
 * 所有接口请求仓库
 */
object ApiRepo {
    /**
     * 获取额外费用记录
     * @param orderId String
     * @return Flow<EwBean>
     */
    fun getOtherCost(orderId: String): Flow<ResponseBean<EwBean>> {
        return RxHttp.postForm(URLConstants.getOtherCost)
            .add("order_id", orderId)
            .toFlowResponse()
    }

    /**
     * 上传服务中图片视频
     * @param orderId String
     * @param service_img String
     * @param service_video String
     * @return Flow<Any>
     */
    fun doService(
        orderId: String,
        service_img: String = "",
        service_video: String = ""
    ): Flow<ResponseBean<Any>> {
        val params = mutableMapOf<String, Any>()
        params["id"] = orderId
        if (service_img.isNotEmpty()) {
            params["service_img"] = service_img
        }
        if (service_video.isNotEmpty()) {
            params["service_video"] = service_video
        }
        return RxHttp.postForm(URLConstants.do_service)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 出示验收码
     * @param orderId String
     * @return Flow<YanShou>
     */
    fun checkOrder(orderId: String): Flow<ResponseBean<YanShou>> {
        return RxHttp.postForm(URLConstants.check_order)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 订单详情
     * @param orderId String
     * @return Flow<OrderDetail2Bean>
     */
    fun getMasterOrderDetail(orderId: String): Flow<ResponseBean<OrderDetail2Bean>> {
        return RxHttp.postForm(URLConstants.get_master_order_detail)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 修改确认上门时间
     * @param orderId String
     * @param service_day String
     * @param service_time String
     * @return Flow<String>
     */
    fun confirmUpdateServiceTime(
        orderId: String,
        service_day: String,
        service_time: String
    ): Flow<ResponseBean<String>> {
        return RxHttp.postForm(URLConstants.confirmUpdateServiceTime)
            .add("order_id", orderId)
            .add("service_day", service_day)
            .add("service_time", service_time)
            .toFlowResponse()
    }

    /**
     * 是否可以确认上门
     * @param orderId String
     * @param lat String
     * @param lng String
     * @return Flow<SmBean>
     */
    fun isConfirmDoorVisit(orderId: String, lat: String, lng: String): Flow<ResponseBean<SmBean>> {
        return RxHttp.postForm(URLConstants.is_confirm_door_visit)
            .add("id", orderId)
            .add("lat", lat)
            .add("lng", lng)
            .toFlowResponse()
    }

    /**
     * 获取订单列表
     * @param status Int
     * @param page Int
     * @param date String
     * @param date_type Int
     * @param keyword String
     * @param is_rework Int
     * @param start_date String
     * @param end_date String
     * @return Flow<MutableList<OrderBean>>
     */
    fun getMasterOrderList(
        status: Int,
        page: Int,
        date: String = "",
        date_type: Int = 0,
        keyword: String = "",
        is_rework: Int = 0,
        start_date: String = "",
        end_date: String = "",
        hexiao_type: String = "",
    ): Flow<ResponseBean<MutableList<OrderBean>>> {
        val params = mutableMapOf<String, Any>()
        params["status"] = status
        params["page"] = page
        if (date.isNotEmpty()) {
            params["date"] = date
            params["date_type"] = date_type
        }
        if (keyword.isNotEmpty()) {
            params["keyword"] = keyword
        }
        params["is_rework"] = is_rework
        if (start_date.isNotEmpty()) {
            params["start_date"] = start_date
        }
        if (end_date.isNotEmpty()) {
            params["end_date"] = end_date
        }
        if (hexiao_type.isNotEmpty()) {
            params["hexiao_type"] = hexiao_type
        }
        return RxHttp.postForm(URLConstants.get_master_order_list)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 聚焦日历
     * @return Flow<MutableList<FocusDateBean>>
     */
    fun getMasterCalendar(
        status: Int,
        date: String
    ): Flow<ResponseBean<MutableList<FocusDateBean>>> {
        return RxHttp.postForm(URLConstants.getMasterCalendar)
            .add("status", status)
            .add("date", date)
            .toFlowResponse()
    }

    /**
     * 发送短信验证码
     * @param mobile String
     * @param type Int
     * 1登录 2注册 3设置支付密码 4解绑手机号 5绑定新手机号 6修改登录密码
     * 7企业认证 8实名认证 10完善用户信息,11绑定账户,12抖音绑定 13修改验证码
     * @return Flow<Any>
     */
    fun senSms(mobile: String, type: Int): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.sendSMS)
            .add("mobile", mobile)
            .add("type", type)
            .add("sms_type", 2)
            .toFlowResponse()
    }

    /**
     * 修改紧急电话
     * @param mobile String
     * @param code String
     * @return Flow<Any>
     */
    fun editEmergencyContact(mobile: String, code: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.editEmergencyContact)
            .add("emergency_contact", mobile)
            .add("code", code)
            .toFlowResponse()
    }

    /**
     *
     * 发送短信验证码
     * @param mobile String
     * @param type String 1: 注册 2 3 4 5 6: 忘记密码 7: 登录 13: 备用手机号
     * @return Flow<ResponseBean<Any>>
     */
    fun sendSMS(mobile: String, type: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.sendSMS)
            .add("mobile", mobile)
            .add("type", type)
            .add("sms_type", "2")
            .toFlowResponse()
    }


    /**
     * 注册
     * @param phone String
     * @param code String
     * @param password String
     * @param phoneSpare String
     * @param codeSpare String
     * @return Flow<ResponseBean<UserBean>>
     */
    fun register(
        phone: String,
        code: String,
        password: String,
        phoneSpare: String,
        codeSpare: String
    ): Flow<ResponseBean<UserBean>> {
        return RxHttp.postForm(URLConstants.register)
            .add("mobile", phone)
            .add("code", code)
            .add("password", password)
            .add("enter_password", password)
            .add("spare_phone", phoneSpare)
            .add("spare_code", codeSpare)
            .toFlowResponse()
    }

    /**
     * 找回密码
     * @param mobile String
     * @param code String
     * @param password String
     * @return Flow<ResponseBean<Any>>
     */
    fun forget(mobile: String, code: String, password: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.forget)
            .add("mobile", mobile)
            .add("code", code)
            .add("password", password)
            .toFlowResponse()
    }

    fun login(
        mobile: String,
        login_type: String,
        password: String = "",
        code: String = ""
    ): Flow<ResponseBean<UserBean>> {
        val params = mutableMapOf<String, Any>()
        params["mobile"] = mobile
        params["login_type"] = login_type
        if (login_type == "1") {
            params["password"] = password
        }
        if (login_type == "2") {
            params["code"] = code
        }
        return RxHttp.postForm(URLConstants.login)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 获取帮助列表
     * @return Flow<ResponseBean<MutableList<LoginHelpBean>>>
     */
    fun loginHelpList(): Flow<ResponseBean<LoginHelpTelBean>> {
        return RxHttp.postForm(URLConstants.loginHelpList)
            .toFlowResponse()
    }

    /**
     *
     * @return Flow<ResponseBean<HomeDataBean>>
     */
    fun getHomeData(): Flow<ResponseBean<HomeDataBean>> {
        return RxHttp.postForm(URLConstants.getHomeData)
            .toFlowResponse()
    }

    /**
     * 获取系统配置信息
     * @return Flow<ResponseBean<SystemConfigBean>>
     */
    fun getSystemConfig(): Flow<ResponseBean<SystemConfigBean>> {
        return RxHttp.postForm(URLConstants.getSystemConfig)
            .toFlowResponse()
    }

    /**
     * 验证门店是否上传了营业执照
     */
    fun checkStoreLicense(): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.checkStoreLicense)
            .toFlowResponse()
    }

    /**
     * 获取门店入驻信息
     * @return Flow<ResponseBean<SettledInfoBean>>
     */
    fun getStoreSettledInfo(): Flow<ResponseBean<SettledInfoBean>> {
        return RxHttp.postForm(URLConstants.getStoreSettledInfo)
            .toFlowResponse()
    }

    /**
     * 获取合作期限
     * @param city String?
     * @return Flow<ResponseBean<CooperationTimeBean>>
     */
    fun getCooperationPeriod(city: String?): Flow<ResponseBean<MutableList<CooperationTimeBean>>> {
        return RxHttp.postForm(URLConstants.getCooperationPeriod)
            .add("city_id", city)
            .toFlowResponse()
    }

    /**
     * 提交入驻申请信息
     * @param real_name String?
     * @param mobile String?
     * @param card_front String?
     * @param card_side String?
     * @param team_name String?
     * @param team_logo String?
     * @param team_num String?
     * @param team_company_pic String?
     * @param synopsis String?
     * @param province String?
     * @param city String?
     * @param area String?
     * @param address String?
     * @param lng String?
     * @param lat String?
     * @param service_year String?
     * @param service_id Int?
     * @return Flow<ResponseBean<SettledInfoBean>>
     */
    fun applySettled(
        real_name: String?,
        mobile: String?,
        card_front: String?,
        card_side: String?,
        team_name: String?,
        team_logo: String?,
        team_num: String?,
        team_company_pic: String?,
        team_side_logo: String?,
        team_right_logo: String?,
        synopsis: String?,
        province: String?,
        city: String?,
        area: String?,
        address: String?,
        lng: String?,
        lat: String?,
        service_year: String?,
        service_id: Int?,
        is_edit: Int?,
        is_entity: Int?, // 是否有实体店
        Address: String?,
        BirthDate: String?,
        EndDate: String?,
        Gender: String?,
        IDNumber: String?,
        Issue: String?,
        Name: String?,
        Nationality: String?,
        StartDate: String?
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.applySettled)
            .add("real_name", real_name)
            .add("mobile", mobile)
            .add("card_front", card_front)
            .add("card_side", card_side)
            .add("team_name", team_name)
            .add("team_logo", team_logo)
            .add("team_num", team_num)
            .add("team_company_pic", team_company_pic)
            .add("team_side_logo", team_side_logo)
            .add("team_right_logo", team_right_logo)
            .add("synopsis", synopsis)
            .add("province", province)
            .add("city", city)
            .add("area", area)
            .add("address", address)
            .add("lng", lng)
            .add("lat", lat)
            .add("service_year", service_year)
            .add("service_id", service_id)
            .add("is_edit",is_edit)
            .add("is_entity",is_entity)

            .add("native_place", Address)
            .add("user_birthday", BirthDate)
            .add("id_card_end_date", EndDate)
            .add("user_sex", Gender)
            .add("id_card", IDNumber)
            .add("id_card_issue", Issue)
            .add("user_name", Name)
            .add("nation", Nationality)
            .add("id_card_start_date", StartDate)
            .toFlowResponse()
    }

    /**
     * 获取门店个人信息
     * @return Flow<ResponseBean<TeamUserInfoBean>>
     */
    fun getStoreInfo(): Flow<ResponseBean<UserBean>> {
        return RxHttp.postForm(URLConstants.getStoreInfo)
            .toFlowResponse()
    }

    /**
     * 获取人脸识别参数信息
     */
    fun getFaceParam(
        certName: String?,
        certNo: String?,
        metaInfo: String?
    ): Flow<ResponseBean<FaceParamsBean>> {
        return RxHttp.postForm(URLConstants.getFaceRecognitionInfo)
            .add("certName", certName)
            .add("certNo", certNo)
            .add("metaInfo", metaInfo)
            .toFlowResponse()
    }

    /**
     * 人脸识别回调
     */
    fun faceRecognitionCallback(): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.faceRecognitionCallback)
            .add("id_card", AccountUtils.user?.id_card)
            .add("real_name", AccountUtils.user?.user_name)
            .toFlowResponse()
    }

    /**
     * 合同签名
     */
    fun contractSign(signature_img: String?): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.contractSign)
            .add("signature_img", signature_img)
            .toFlowResponse()
    }

    /**
     * 上传营业执照
     */
    fun uploadBusinessLicense(business_license: String?): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.uploadStoreLicense)
            .add("team_company_pic", business_license)
            .toFlowResponse()
    }

    /**
     * 获取门店支付年费信息
     */
    fun getYearMoney(): Flow<ResponseBean<StoreYearMoneyBean>> {
        return RxHttp.postForm(URLConstants.getYearMoney)
            .toFlowResponse()
    }

    /**
     * 获取培训文章列表
     */
    fun getTrainArticleList(
        type_id: Int,
        page: Int
    ): Flow<ResponseBean<MutableList<TrainArticleBean>>> {
        return RxHttp.postForm(URLConstants.getTrainArticleList)
            .add("type_id", type_id)
            .add("page", page)
            .add("is_app_show", 2)
            .toFlowResponse()
    }

    /**
     * 获取培训考试文章列表
     */
    fun getTrainExamArticleList(
        type_id: String,
        page: Int
    ): Flow<ResponseBean<MutableList<TrainArticleBean>>> {
        return RxHttp.postForm(URLConstants.getTrainExamArticleList)
            .add("type_id", type_id)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 获取培训文章分类
     */
    fun getTrainLabel(): Flow<ResponseBean<MutableList<TrainLabelBean>>> {
        return RxHttp.postForm(URLConstants.getTrainLabel)
            .toFlowResponse()
    }

    /**
     * 获取培训考试试题
     */
    fun getTrainExamQuestion(article_id: Int): Flow<ResponseBean<ExamQuestionBean>> {
        return RxHttp.postForm(URLConstants.getTrainExamQuestion)
            .add("article_id", article_id)
            .toFlowResponse()
    }

    /**
     * 提交考试结果
     */
    fun submitExamResult(
        rate: String,
        integral: String,
        type: String,
        article_id: Int,
        ture_num: String,
        error_num: String
    ): Flow<ResponseBean<Any>> {
        val params = mutableMapOf<String, Any>()
        params["rate"] = rate
        params["integral"] = integral
        params["type"] = type
        if (article_id > 0) {
            params["article_id"] = article_id
        }
        params["ture_num"] = ture_num
        params["error_num"] = error_num
        return RxHttp.postForm(URLConstants.submitExamResult)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 消息数量统计
     */
    fun getMessageCount(): Flow<ResponseBean<MessageStatisticsBean>> {
        return RxHttp.postForm(URLConstants.getMessageCount)
            .toFlowResponse()
    }

    /**
     * 获取登录状态
     */
    fun getLoginStatus(): Disposable {
        return RxHttp.postForm(URLConstants.is_master_msg)
            .toObservableResponse(Any::class.java)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe()
    }

    /**
     * 设置消息已读
     */
    fun masterSetMessageRead(id: Int?, type: Int): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.masterSetMessageRead)
            .add("id", id)
            .add("type", type)
            .toFlowResponse()
    }

    /**
     * 门店消息中的申请操作同意/拒绝
     */
    fun operateTeam(message_id: Int?, consent: Int): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.operateTeam)
            .add("message_id", message_id)
            .add("consent", consent)
            .toFlowResponse()
    }

    /**
     * 删除异常消息
     */
    fun delApplyReworkMsg(id: Int?): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.delApplyReworkMsg)
            .add("id", id)
            .toFlowResponse()
    }

    /**
     * 订单申诉
     */
    fun appealOrderFeedback(
        feedback_id: Int?,
        content: String,
        pics: String
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.appealOrderFeedback)
            .add("feedback_id", feedback_id)
            .add("content", content)
            .add("pics", pics)
            .toFlowResponse()
    }

    /**
     * 差评申诉
     */
    fun userOrderAppeal(
        order_id: Int?,
        content: String,
        images: String
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.userOrderAppeal)
            .add("order_id", order_id)
            .add("content", content)
            .add("images", images)
            .toFlowResponse()
    }

    /**
     * 获取系统消息
     */
    fun getSystemMessage(p: Int): Flow<ResponseBean<MutableList<SystemMsgBean>>> {
        return RxHttp.postForm(URLConstants.getSystemMsg)
            .add("page", p)
            .toFlowResponse()
    }

    /**
     * 获取订单消息
     */
    fun getStoreOrderMsg(p: Int): Flow<ResponseBean<MutableList<MasterStoreOrderBean>>> {
        return RxHttp.postForm(URLConstants.getOrderMsg)
            .add("page", p)
            .toFlowResponse()
    }

    /**
     * 获取异常订单消息
     */
    fun getMasterOrderFeedbackMsg(
        p: Int,
        is_deal: Int
    ): Flow<ResponseBean<MutableList<ErrorMessageBean>>> {
        return RxHttp.postForm(URLConstants.getOrderFeedback)
            .add("page", p)
            .add("is_deal", is_deal)
            .toFlowResponse()
    }

    /**
     * 获取门店消息
     */
    fun getMessageList(p: Int): Flow<ResponseBean<MutableList<TeamMessageBean>>> {
        return RxHttp.postForm(URLConstants.getTeamMsg)
            .add("page", p)
            .toFlowResponse()
    }

    /**
     * 师傅同意处罚
     * @param id String
     * @return Flow<Any>
     */
    fun masterAgreePunishment(id: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.masterAgreePunishment)
            .add("id", id)
            .toFlowResponse()
    }
    /**
     * 师傅同意处罚  订单投诉
     * @param id String
     * @return Flow<Any>
     */
    fun masterAgreeComplaint(id: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.masterAgreeComplaint)
            .add("id", id)
            .toFlowResponse()
    }

    /**
     * 获取订单详情
     */
    fun getServiceOrderDetail(id: String?): Flow<ResponseBean<OrderDetailBean>> {
        return RxHttp.postForm(URLConstants.getServiceOrderDetail)
            .add("id", id)
            .toFlowResponse()
    }


    /**
     * 拒绝返工
     */
    fun masterRejectApplyRework(
        order_id: String?,
        reject_reason: String,
        reject_reason_images: String
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.masterRejectApplyRework)
            .add("order_id", order_id)
            .add("reject_reason", reject_reason)
            .add("reject_reason_images", reject_reason_images)
            .toFlowResponse()
    }

    /**
     * 待确认数据信息
     */
    fun confirmOrderTime(orderId: String): Flow<ResponseBean<YyBean>> {
        return RxHttp.postForm(URLConstants.confirmOrderTime)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 同意返工, 创建返工单
     */
    fun masterAgreeRework(
        original_id: String,
        service_day: String,
        service_time: String,
        team_leader: String = "",
        team_member: String = ""
    ): Flow<ResponseBean<Any>> {
        val params = mutableMapOf<String, Any>()
        params["original_id"] = original_id
        params["service_day"] = service_day
        params["service_time"] = service_time
        if (team_leader.isNotEmpty()) {
            params["team_leader"] = team_leader
        }
        if (team_member.isNotEmpty()) {
            params["team_member"] = team_member
        }
        return RxHttp.postForm(URLConstants.masterAgreeRework)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 获取师傅服务时间
     * @param time String 2019-08-07
     * @param cate_id String 二级分类id
     */
    fun getMasterServiceTime(
        time: String,
        cate_id: String
    ): Flow<ResponseBean<MutableList<TimeBean2>>> {
        return RxHttp.postForm(URLConstants.getMasterServiceTime)
            .add("time", time)
            .add("cate_id", cate_id)
            .toFlowResponse()
    }

    /**
     * 师傅补偿用户心意金
     */
    fun masterCompensateMindAmount(orderId: String, mind_amount: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.masterCompensateMindAmount)
            .add("id", orderId)
            .add("mind_amount", mind_amount)
            .toFlowResponse()
    }

    /**
     * 添加任务指派
     */
    fun addAppoint(id: String, team_leader: String, team_member: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.addAppoint)
            .add("id", id)
            .add("team_leader", team_leader)
            .add("team_member", team_member)
            .toFlowResponse()
    }

    /**
     * 任务指派页面数据
     */
    fun appointData(orderId: String): Flow<ResponseBean<RenWuBean>> {
        return RxHttp.postForm(URLConstants.appointData)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 首页数据统计
     */
    fun getDataStatistical(
        type: Int,
        start_time: String = "",
        end_time: String = ""
    ): Flow<ResponseBean<DataStatisticalBean>> {
        val params = mutableMapOf<String, Any>()
        if (type != 0) {
            params["type"] = type
        }
        if (start_time.isNotEmpty()) {
            params["start_time"] = start_time
        }
        if (end_time.isNotEmpty()) {
            params["end_time"] = end_time
        }
        return RxHttp.postForm(URLConstants.getDataStatistical)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 门店下师傅列表
     */
    fun getStoreTeamMember(): Flow<ResponseBean<MutableList<MemberBean>>> {
        return RxHttp.postForm(URLConstants.getStoreTeamMember)
            .toFlowResponse()
    }

    /**
     * 门店下技能列表
     */
    fun getStoreService(): Flow<ResponseBean<MutableList<StoreServiceSkillBean>>> {
        return RxHttp.postForm(URLConstants.getStoreService)
            .toFlowResponse()

    }

    /**
     * 门店成员统计
     */
    fun getMemberStatistical(
        type: Int,
        start_time: String = "",
        end_time: String = "",
        child_id: String = ""
    ): Flow<ResponseBean<StoreMemberDataStatisticalBean>> {
        val params = mutableMapOf<String, Any>()
        if (type != 0) {
            params["type"] = type
        }
        if (start_time.isNotEmpty()) {
            params["start_time"] = start_time
        }
        if (end_time.isNotEmpty()) {
            params["end_time"] = end_time
        }
        if (child_id.isNotEmpty()) {
            params["child_id"] = child_id
        }
        return RxHttp.postForm(URLConstants.getMemberStatistical)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 门店下服务统计
     */
    fun getServiceStatistical(
        type: Int,
        start_time: String = "",
        end_time: String = "",
        service_id: String = ""
    ): Flow<ResponseBean<StoreServiceDataStatisticalBean>> {
        val params = mutableMapOf<String, Any>()
        if (type != 0) {
            params["type"] = type
        }
        if (start_time.isNotEmpty()) {
            params["start_time"] = start_time
        }
        if (end_time.isNotEmpty()) {
            params["end_time"] = end_time
        }
        if (service_id.isNotEmpty()) {
            params["service_id"] = service_id
        }
        return RxHttp.postForm(URLConstants.getServiceStatistical)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 排行
     * @param sort_type 1.已完成订单数 2.总收益 3.好评率 4.订单数
     */
    fun getDataRank(
        type: Int,
        start_time: String = "",
        end_time: String = "",
        sort_type: Int = 1
    ): Flow<ResponseBean<MutableList<DataRankBean>>> {
        val params = mutableMapOf<String, Any>()
        if (type != 0) {
            params["type"] = type
        }
        if (start_time.isNotEmpty()) {
            params["start_time"] = start_time
        }
        if (end_time.isNotEmpty()) {
            params["end_time"] = end_time
        }
        params["sort_type"] = sort_type
        return RxHttp.postForm(URLConstants.getRank)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 设置门店订单奖励
     * @param team_id String?
     * @param order_award Int
     * @return Flow<Any>
     */
    fun setOrderAward(
        team_id: String?,
        order_award: Int
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.setOrderAward)
            .add("order_award", order_award)
            .toFlowResponse()
    }

    /**
     * 门店设置信息
     */
    fun getTeamSettingsInfo(): Flow<ResponseBean<TeamSettingsInfoBean>> {
        return RxHttp.postForm(URLConstants.teamSettingsInfo)
            .toFlowResponse()
    }

    /**
     * 设置门店违约金扣除
     */
    fun setOrderDedit(order_dedit: Int): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.setOrderDedit)
            .add("order_dedit", order_dedit)
            .toFlowResponse()
    }

    /**
     * 获取城市列表
     */
    fun getRegionNameByParentId(parentId: String = ""): Flow<ResponseBean<MutableList<CityBean>>> {
        val params = mutableMapOf<String, Any>()
        if (parentId.isNotEmpty()) {
            params["parent_id"] = parentId
        }
        return RxHttp.postForm(URLConstants.getRegionNameByParentId)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 更新门店服务区域
     */
    fun updateTeamArea(city_id: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.updateTeamArea)
            .add("city_id", city_id)
            .toFlowResponse()
    }

    /**
     * 修改门店分成比例
     */
    fun updateTeamRate(
        team_rate: String,
        team_leader_rate: String,
        team_member_rate: String
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.updateTeamRate)
            .add("team_rate", team_rate)
            .add("team_leader_rate", team_leader_rate)
            .add("team_member_rate", team_member_rate)
            .toFlowResponse()
    }

    /**
     * 设置门店优先接单距离
     */
    fun setOrderDistance(order_distance: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.setOrderDistance)
            .add("order_distance", order_distance)
            .toFlowResponse()
    }

    /**
     * 门店申请的技能记录
     */
    fun getTeamCategoryList(): Flow<ResponseBean<MutableList<Jn2Bean>>> {
        return RxHttp.postForm(URLConstants.getTeamCategoryList)
            .toFlowResponse()
    }

    /**
     * 添加技能展示
     */
    fun getAddSkillList(type: Int): Flow<ResponseBean<MutableList<SkillAddBean>>> {
        val params = mutableMapOf<String, Any>()
        params["type"] = type
        return RxHttp.postForm(URLConstants.getAddSkillList)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 添加技能
     */
    fun updateTeamCategory(
        service_ids: String,
        small_ids: String,
        little_ids: String
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.updateTeamCategory)
            .add("service_ids", service_ids)
            .add("small_ids", small_ids)
            .add("little_ids", little_ids)
            .toFlowResponse()
    }

    /**
     * 技能中心移除技能
     */
    fun undockTeamCategory(first_ids: String, small_ids: String, ids: String): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.undockTeamCategory)
            .add("first_ids", first_ids)
            .add("small_ids", small_ids)
            .add("ids", ids)
            .toFlowResponse()
    }

    /**
     * 获取钱包主页数据
     */
    fun getWalletDetail(): Flow<ResponseBean<WalletBean>> {
        return RxHttp.postForm(URLConstants.getWalletDetail)
            .toFlowResponse()
    }

    /**
     * 冻结保证金大类列表
     *
     */
    fun getDepositList(is_deposit: Int): Flow<ResponseBean<MutableList<DepositBean>>> {
        return RxHttp.postForm(URLConstants.getDepositList)
            .toFlowResponse()
    }

    /**
     * 冻结金额记录按天分组
     */
    fun getMasterDepositGroupByDayList(
        fcate_id: String,
        is_team: Int
    ): Flow<ResponseBean<DepositGroupByDayBean>> {
        return RxHttp.postForm(URLConstants.getMasterDepositGroupByDayList)
            .add("fcate_id", fcate_id)
            .toFlowResponse()
    }

    /**
     * 冻结保证金明细
     */
    fun getDepositDetail(id: String): Flow<ResponseBean<DJDetailBean>> {
        return RxHttp.postForm(URLConstants.getDepositDetail)
            .add("id", id)
            .toFlowResponse()
    }

    /**
     * 获取可提现列表
     * @param page Int
     * @return Flow<WithdrawableBean>
     */
    fun getNotWithdrawList(page: Int): Flow<ResponseBean<WithdrawableBean>> {
        return RxHttp.postForm(URLConstants.getNotWithdrawList)
            .add("page", page)
            .add("limit", 10)
            .toFlowResponse()
    }

    /**
     * 违规扣除订单列表
     * @param id String
     * @param page Int
     * @return Flow<BalanceDetailGroupListBean>
     */
    fun getViolationDeductMoneyOrderList(
        id: String,
        page: Int
    ): Flow<ResponseBean<BalanceDetailGroupListBean>> {
        return RxHttp.postForm(URLConstants.masterBillGroupByDayList)
            .add("bill_ids", id)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 获取余额明细分组列表
     * @param type Int
     * @param page Int
     * @return Flow<BalanceDetailGroupListBean>
     */
    fun masterBillGroupByDayList(
        type: Int,
        page: Int
    ): Flow<ResponseBean<BalanceDetailGroupListBean>> {
        return RxHttp.postForm(URLConstants.masterBillGroupByDayList)
            .add("type", type)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 微信登录
     */
    fun wechatLogin(code: String): Flow<ResponseBean<UserBean>> {
        return RxHttp.postForm(URLConstants.wechatLogin)
            .add("code", code)
            .toFlowResponse()
    }

    /**
     * f发布通知
     */
    fun publishNotice(user_ids: String, content: String): Flow<ResponseBean<Any>> {
        val params = mutableMapOf<String, Any>()
        if (user_ids.isNotEmpty()) {
            params["user_ids"] = user_ids
        }
        params["content"] = content
        return RxHttp.postForm(URLConstants.publishNotice)
            .addAll(params)
            .toFlowResponse()
    }

    /**
     * 修改门店信息
     */
    fun updateTeamInfo(
        team_name: String,
        team_logo: String,
        team_company_pic: String,
        synopsis: String
    ): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.updateTeamInfo)
            .add("team_name", team_name)
            .add("team_logo", team_logo)
            .add("team_company_pic", team_company_pic)
            .add("synopsis", synopsis)
            .toFlowResponse()
    }


    /**
     * 获取订单数量
     * @return Flow<NumBean>
     */
    fun getMasterOrderNum(): Flow<ResponseBean<NumBean>> {
        return RxHttp.postForm(URLConstants.getMasterOrderNum)
            .toFlowResponse()
    }

    /**
     * 获取不感兴趣标签
     * @return Flow<MutableList<String>>
     */
    fun getUnlikeTag(): Flow<ResponseBean<MutableList<String>>> {
        return RxHttp.postForm(URLConstants.getUnlikeTag)
            .toFlowResponse()
    }

    /**
     * 获取抢单列表
     * @param page Int
     * @return Flow<MutableList<HomeBean>>
     */
    fun getMasterTaskList(page: Int): Flow<ResponseBean<MutableList<HomeBean>>> {
        return RxHttp.postForm(URLConstants.getMasterTaskList)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 提交不感兴趣数据
     * @param oid String
     * @param unlike_tag String
     * @param remark String
     * @return Flow<Any>
     */
    fun add_unlike_order(oid: String, unlike_tag: String, remark: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.add_unlike_order)
            .add("oid", oid)
            .add("unlike_tag", unlike_tag)
            .add("remark", remark)
            .toFlowResponse()
    }

    /**
     * 验证是否能接单
     * @param orderId String
     * @return Flow<Any>
     */
    fun verifyTakeTask(orderId: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.verifyTakeTask)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 师傅接单
     * @param orderId String
     * @return Flow<Any>
     */
    fun masterTakeTask(orderId: String): Flow<ResponseBean<Home4Bean>> {
        return RxHttp.postForm(URLConstants.masterTakeTask)
            .add("id", orderId)
            .add("take_order_source", 2) // 接单来源
            .toFlowResponse()
    }

    /**
     * 获取抢单未认证技能信息
     * @param orderId String
     * @return Flow<Jnrz>
     */
    fun masterGetSkill(orderId: String): Flow<ResponseBean<Jnrz>> {
        return RxHttp.postForm(URLConstants.masterGetSkill)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 去验证服务的时候调用接口
     * @param service_ids String 二级分类
     * @param little_ids String 三级分类
     * @return Flow<Any>
     */
    fun verifyService(service_ids: String, little_ids: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.verifyService)
            .add("service_ids", service_ids)
            .add("little_ids", little_ids)
            .toFlowResponse()
    }

    /**
     * 抢单订单详情
     * @param orderId String
     * @return Flow<DetaiBean>
     */
    fun getMasterTakeTaskDetail(orderId: String): Flow<ResponseBean<DetaiBean>> {
        return RxHttp.postForm(URLConstants.get_master_take_task_detail)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 任务指派 门店成员列表
     * @param id String?  订单id
     * @return Flow<TeamMemberBean>
     */
    fun getTeamMemberList(id: String?): Flow<ResponseBean<TeamMemberBean>> {
        return RxHttp.postForm(URLConstants.getTeamMemberList)
            .add("id", id)
            .toFlowResponse()
    }

    /**
     * 门店长 个人单指派
     * @param id String?
     * @param team_member String?
     * @return Flow<Any>
     */
    fun personalAddAppoint(id: String?, team_member: String?): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.personalAddAppoint)
            .add("id", id)
            .add("team_member", team_member)
            .toFlowResponse()
    }

    /**
     * 获取预约订单列表
     * @return Flow<MutableList<OrderBean>>
     */
    fun getMasterAppointmentOrderList(page: Int): Flow<ResponseBean<MutableList<OrderBean>>> {
        return RxHttp.postForm(URLConstants.get_master_yuyue_order_list)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 提醒客户
     * @param orderId String
     * @return Flow<Any>
     */
    fun remindCheck(orderId: String): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.remind_check)
            .add("id", orderId)
            .toFlowResponse()
    }

    /**
     * 获取所有服务列表
     */
    fun getAllSkillList(): Flow<ResponseBean<MutableList<ChooseServiceBean>>> {
        return RxHttp.postForm(URLConstants.getAllSkillList)
            .toFlowResponse()
    }

    /**
     * 门店下单
     */
    fun teamAddOrder(
        product_id: String,
        suk_unique: String,
        pay_price: String,
        add_pay_price: String,
        discount_pay_price: String,
        service_day: String,
        service_time: String,
        user_phone: String,
        real_name: String,
        mark: String,
        province_id: String,
        city_id: String,
        area_id: String,
        detail: String,
        house_number: String,
        key_areas: String,
    ): Flow<ResponseBean<TakeOrderBean>> {
        return RxHttp.postForm(URLConstants.teamAddOrder)
            .add("product_id", product_id)
            .add("suk_unique", suk_unique)
            .add("pay_price", pay_price)
            .add("add_pay_price", add_pay_price)
            .add("discount_pay_price", discount_pay_price)
            .add("service_day", service_day)
            .add("service_time", service_time)
            .add("user_phone", user_phone)
            .add("real_name", real_name)
            .add("mark", mark)
            .add("province_id", province_id)
            .add("city_id", city_id)
            .add("area_id", area_id)
            .add("detail", detail)
            .add("house_number", house_number)
            .add("key_areas", key_areas)
            .toFlowResponse()
    }

    /**
     * 门店下单记录
     */
    fun getTeamOrderRecord(status: Int, page: Int): Flow<ResponseBean<MutableList<TakeOrderRecordBean>>> {
        return RxHttp.postForm(URLConstants.getTeamOrderRecord)
            .add("status", status)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 订单支付二维码
     */
    fun createPayQrcode(order_id: String): Flow<ResponseBean<TakeOrderPayCodeBean>> {
        return RxHttp.postForm(URLConstants.createPayQrcode)
            .add("order_id", order_id)
            .toFlowResponse()
    }

    /**
     * 获取平台福利列表
     */
    fun getWelfareList(): Flow<ResponseBean<MutableList<PlatformWelfareBean>>> {
        return RxHttp.postForm(URLConstants.getWelfareList)
            .toFlowResponse()
    }

    /**
     * 服务免单记录
     */
    fun getServiceFreeLog(page: Int): Flow<ResponseBean<MutableList<FreeOrderWelfareBean>>>{
        return RxHttp.postForm(URLConstants.getServiceFreeLog)
            .add("page", page)
            .toFlowResponse()
    }


    /**
     * 推送订单记录
     */
    fun getPushOrderLog(page: Int): Flow<ResponseBean<MutableList<PushOrderWelfareBean>>>{
        return RxHttp.postForm(URLConstants.getPushOrderLog)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 服务工具 店铺开通记录
     */
    fun getTeamToolLog(type: Int, page: Int): Flow<ResponseBean<MutableList<ToolUseRecordBean>>>{
        return RxHttp.postForm(URLConstants.getTeamToolLog)
            .add("type", type)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 获取保险申请记录
     */
    fun getInsureApplyRecord(page: Int): Flow<ResponseBean<MutableList<InsureApplyRecordBean>>>{
        return RxHttp.postForm(URLConstants.getInsureApplyRecord)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 保险使用记录
     */
    fun getInsureUseRecord(page: Int): Flow<ResponseBean<MutableList<InsureUseRecordBean>>>{
        return RxHttp.postForm(URLConstants.getInsureUseRecord)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 保险申请
     */
    fun applyMasterInsurance(apply_json: String): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.applyMasterInsurance)
            .add("apply_json", apply_json)
            .toFlowResponse()
    }

    /**
     * 根据订单id查询服务人员
     */
    fun getOrderServiceMember(id: String): Flow<ResponseBean<MutableList<OrderWorkerBean>>>{
        return RxHttp.postForm(URLConstants.getOrderServiceMember)
            .add("id", id)
            .toFlowResponse()
    }

    /**
     * 设置短信通知开关 0.关闭 1.开启
     */
    fun setNote(is_note: Int): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.setNote)
            .add("is_note", is_note)
            .toFlowResponse()
    }

    /**
     * 版本信息
     */
    fun getAppVersions(): Flow<ResponseBean<AppVersionBean>>{
        return RxHttp.postForm(URLConstants.getAppVersions)
            .toFlowResponse()
    }

    /**
     * 邀请不存在的账号
     */
    fun inviteTeamMember(phones: String, first_level_ids: String, second_level_ids: String, little_ids: String): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.inviteTeamMember)
            .add("phones", phones)
            .add("first_level_ids", first_level_ids)
            .add("service_ids", second_level_ids)
            .add("little_ids", little_ids)
            .toFlowResponse()
    }

    /**
     * 邀请记录
     * @param type 0: 全部, 1: 未入驻, 2: 已入驻
     * @param time_type 0: 全部, 1: 今日, 2: 本周, 3: 本月, 4: 本年
     */
    fun spreadServiceRecord(type: Int, time_type: Int, start_time: String, end_time: String, page: Int): Flow<ResponseBean<MutableList<SpreadServiceRecordBean>>>{
        return RxHttp.postForm(URLConstants.spreadServiceRecord)
            .add("type", type)
            .add("time_type", time_type)
            .add("start_time", start_time)
            .add("end_time", end_time)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 上传核销码
     * @param id String?    订单id
     * @param imageUrl String?
     * @return Flow<Any>
     */
    fun uploadWriteOffCodeImage(id: String?, imageUrl: String?): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.uploadWriteOffCodeImage)
            .add("id", id)
            .add("write_off_image", imageUrl)
            .toFlowResponse()
    }

    /**
     * 额外费用收款二维码
     * @param orderId String
     * @return Flow<ExtraCostsPayBean>
     */
    fun makeCostScanPayOrder(orderId: String): Flow<ResponseBean<ExtraCostsPayBean>> {
        return RxHttp.postForm(URLConstants.makeCostScanPayOrder)
            .add("order_id", orderId)
            .toFlowResponse()
    }

    /**
     * 二次上门
     * @param id String
     * @param service_day String
     * @param service_time String
     * @param content String
     * @param image String
     * @param money String
     * @param type String
     * @return Flow<Any>
     */
    fun orderSecondVisit(
        id: String?,
        service_day: String?,
        service_time: String?,
        content: String?,
        image: String?,
        money: String?,
        type: String?
    ): Flow<ResponseBean<Any>> {

        return RxHttp.postForm(URLConstants.orderSecondVisit)
            .add("id", id)
            .add("service_day", service_day)
            .add("service_time", service_time)
            .add("content", content)
            .add("image", image)
            .add("money", money)
            .add("type", type)
            .toFlowResponse()

    }

    /**
     * 设置消息全部已读
     * @param type: 1系统消息 2门店消息 3订单消息 4异常订单消息
     */
    fun doMessagesRead(type: Int): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.doMessagesRead)
            .add("type", type)
            .toFlowResponse()
    }

    /**
     * 差评申诉详情
     */
    fun userOrderAppealInfo(order_id: Int?): Flow<ResponseBean<AppealDetailBean>>{
        return RxHttp.postForm(URLConstants.userOrderAppealInfo)
            .add("order_id", order_id)
            .toFlowResponse()
    }

    /**
     * 确认上门
     */
    fun confirmDoor(order_id: String): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.confirmDoor)
            .add("id", order_id)
            .toFlowResponse()
    }

    /**
     * 根据经纬度获取地址
     */
    fun getRemoteAddress(lat: String, lng: String): Flow<ResponseBean<RemoteAddressBean>>{
        return RxHttp.postForm(URLConstants.getRemoteAddress)
            .add("location", "$lng,$lat")
            .toFlowResponse()
    }

    /**
     * 商品福利使用记录
     */
    fun getGoodsWelfareLog(welfare_id: Int?, page: Int): Flow<ResponseBean<MutableList<ShopWelfareRecordBean>>>{
        return RxHttp.postForm(URLConstants.getGoodsWelfareLog)
            .add("welfare_id", welfare_id)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 身份证识别
     */
    fun idCardRecognition(card_front: String, card_side: String): Flow<ResponseBean<IDCardBean>>{
        return RxHttp.postForm(URLConstants.idCardRecognition)
            .add("card_front", card_front)
            .add("card_side", card_side)
            .toFlowResponse()
    }

    /**
     * 获取我的合同列表
     */
    fun getTeamContractList(status: Int, page: Int): Flow<ResponseBean<MutableList<MyContractBean>>>{
        return RxHttp.postForm(URLConstants.getTeamContractList)
            .add("status", status)
            .add("page", page)
            .toFlowResponse()
    }

    /**
     * 添加合同
     */
    fun addContract(start_time: String, end_time: String, contract_picture: String): Flow<ResponseBean<Any>>{
        return RxHttp.postForm(URLConstants.addContract)
            .add("start_time", start_time)
            .add("end_time", end_time)
            .add("contract_picture", contract_picture)
            .toFlowResponse()
    }

    /**
     * 获取公告列表
     */
    fun getNoticeList(): Flow<ResponseBean<MutableList<HomeDataBean.SystemNotice>>>{
        return RxHttp.postForm(URLConstants.getNoticeList)
            .toFlowResponse()
    }

    /**
     * 获取核销订单详情
     */
    fun getHexiaoOrderInfo(hexiao_code: String?): Flow<ResponseBean<HexiaoOrderInfoBean>> {
        return RxHttp.postForm(URLConstants.getHexiaoOrderInfo)
            .add("hexiao_code", hexiao_code)
            .toFlowResponse()
    }
    /**
     * 核销订单
     */
    fun hexiaoOrder(hexiao_code: String?): Flow<ResponseBean<Any>> {
        return RxHttp.postForm(URLConstants.hexiaoOrder)
            .add("hexiao_code", hexiao_code)
            .toFlowResponse()
    }
}